﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Data.SqlClient;
using SqlCon;

namespace yfxt
{
    public partial class cx_lstj_tjlb : Form
    {
        public cx_lstj_tjlb()
        {
            InitializeComponent();
        }

        int ypxh;
        string ypmc;
        string sql_tjlb;
        string sql_ypmc;
        DataTable dt_tjlb = new DataTable();
        DataTable dt_ypmc = new DataTable();

        #region 退出
        private void button1_Click(object sender, EventArgs e)
        {
            this.Close();
        }
        #endregion

        private void cx_lstj_tjlb_Load(object sender, EventArgs e)
        {
            try 
            {
                ypxh = cx_lstj.ypxh;
                sql_tjlb = "select (case when(a.tjfs=1) then '国家调价' when (a.tjfs=2) then '医院调价' end) as tjfs,a.tjrq,a.tjwh,a.tjsl,a.ylsj,a.xlsj from " +
                    "yf_tjjl a" +
                    " where " +
                    "a.yfsb='" + mainform.yfsb + "' " +
                    "and a.ypxh='"+ypxh+"'";
                dt_tjlb.Load(SqlHelper.ExecuteReader(SqlHelper.ConnectionStringLocalTransaction,CommandType.Text,sql_tjlb,null));
                dataGridView1.Columns[0].DataPropertyName = dt_tjlb.Columns[0].ToString();
                dataGridView1.Columns[1].DataPropertyName = dt_tjlb.Columns[1].ToString();
                dataGridView1.Columns[2].DataPropertyName = dt_tjlb.Columns[2].ToString();
                dataGridView1.Columns[3].DataPropertyName = dt_tjlb.Columns[3].ToString();
                dataGridView1.Columns[4].DataPropertyName = dt_tjlb.Columns[4].ToString();
                dataGridView1.Columns[5].DataPropertyName = dt_tjlb.Columns[5].ToString();
                dataGridView1.DataSource = dt_tjlb;

                sql_ypmc = "select ypmc from yk_typk where ypxh='"+ypxh+"'";
                ypmc=(string)SqlHelper.ExecuteScalar(SqlHelper.ConnectionStringLocalTransaction,CommandType.Text,sql_ypmc,null);
                label2.Text = ypmc;
                label4.Text = dt_tjlb.Rows[0]["tjrq"].ToString();
                label6.Text = dt_tjlb.Rows[0]["tjrq"].ToString();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
            

        }
    }
}
